import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { ChildSubscriptionComponent } from './child-subscription/child-subscription.component';

@Component({
    selector: 'app-subscription',
    templateUrl: './subscription.component.html',
    styleUrls: ['./subscription.component.less'],
})
export class SubscriptionComponent implements OnInit {
    @ViewChild(ChildSubscriptionComponent) childComponent: ChildSubscriptionComponent;
    disabled = false;
    constructor() {}

    ngOnInit(): void {}

    submitForm() {
        if (this.childComponent) {
            // @ts-ignore
            this.childComponent.submitForm();
        }
    }

    resetForm() {
        if (this.childComponent) {
            // @ts-ignore
            this.childComponent.resetForm();
        }
    }

    changeFormInvalid(e): void {
        this.disabled = e;
    }

    getChildValue(e){
        console.log(e);
    }
}
